<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<a href="javascript:void(0);" accesskey="1" style="width: 0px; height: 0px; display: none;" ></a>
<table height="77" width="100%" border="0" cellpadding="0" >
   <tr>
     <td width="120px" align="right"><img src="img/Pharma_Logo.gif" alt="Pharma" width="96" height="45" /></td>
     <td width="550px" align="center">
         <table cellpadding="0" cellspacing="0" height="100%" width="100%">
             <tr>
               <td style="border-bottom:solid 7px #103159;" height="35" align="center" valign="bottom">
                    <table cellpadding="0" cellspacing="0" width="99%" border="0">
                       <tr>
                         <td width="20" height="35" align="right" valign="bottom"><img src="img/BGUsuarioIzq.jpg" /></td>
                         <td class="Usuario">
                               <table width="100%" border="0" cellpadding="0" cellspacing="0" >
                                 <tr>
                                   <c:choose>
                                     <c:when test="${usuarioSesion != null}">
                                       <td class="Texto">Bienvenido ${usuarioSesion.nombre}</td>
                                       <td height="16" width="100"><a href="${pageContext.request.contextPath}/logout.do">Cerrar sesion</a></td>
                                     </c:when>
                                     <c:otherwise>
                                       <td height="16" width="100"><a href="${pageContext.request.contextPath}/getLogin.do">Iniciar sesion</a></td>
                                     </c:otherwise>
                                   </c:choose>
                                   <td>
                                 </tr>
                               </table>
                           </td>
                         <td width="20" align="left" valign="bottom"><img src="img/BGUsuarioDer.jpg" /></td>
                       </tr>
                     </table>
                 </td>
             </tr>
             <tr>
               <td height="30">
                    <table cellpadding="0" cellspacing="0" width="99%" border="0">
                       <tr>
                         <td width="11" height="30" valign="top"><img src="img/BGMenuIzq.jpg" /></td>
                         <td class="Menu" valign="top" align="center">
                             <ul id="MenuBar1" class="MenuBarHorizontal">
                                 <li><a href="javascript:void[0];"><c:out value="Nosotros"/>&nbsp;&nbsp;</a></li>
                                 <li><a href="${pageContext.request.contextPath}/getProducts.do"><c:out value="Nuestros Productos"/>&nbsp;&nbsp;</a>
                                   <ul>
                                     <c:forEach var="listaCategorias" items="${listaCategorias}">        			
        								<li><a href="${pageContext.request.contextPath}/getProducts.do?idCategoria=${listaCategorias.idCategoria}" >${listaCategorias.nombre}</a></li>
    								 </c:forEach>                                     
                                   </ul>
                                 </li>
                                 <c:if test="${usuarioSesion != null}">
                                   <c:if test="${usuarioSesion.tipo == 'P'}">
                                     <li><a href="listarProductosPedidos.do">Proveedor&nbsp;&nbsp;</a></li>
                                   </c:if>
                                   <c:if test="${usuarioSesion.tipo == 'L'}">
                                     <li><a href="javascript:void[0];"><c:out value="Logistica"/>&nbsp;&nbsp;</a>
                                       <ul>
                                         <li><a href="${pageContext.request.contextPath}/despachoPedidos.do">Despacho&nbsp;&nbsp;</a></li>
                                         <li><a href="${pageContext.request.contextPath}/irStockCritico.do">Stock Critico&nbsp;&nbsp;</a></li>
                                       </ul>
                                     </li>
                                   </c:if>
                                 </c:if>
                             </ul>
                         </td>
                         <td class="Menu" valign="top" align="left">
                         	<form method="GET" action="${pageContext.request.contextPath}/busqueda.do">
                         		<span class="Texto">Busqueda:</span><input id="findstring" onkeypress="if(onEnter){document.form[0].submit}"/>
                         	</form>
                         </td>
                         <td width="11" valign="top"><img src="img/BGMenuDer.jpg" /></td>
                       </tr>
                     </table>
                 </td>
             </tr>
           </table>
     </td>
     <td align="left" width="116"><img src="img/Logo_Empresa.png" width="140" height="47" /></td>
   </tr>
 </table>